<template>
  <div>
    <user-form title="注册" @submit="isRegister">
      <template #default>
        <router-link class="register-a" to="/login">已有账号,去登录</router-link>
      </template>
    </user-form>
  </div>
</template>

<script>
import UserForm from '@/components/UserForm.vue'
import { registerAPI } from '@/api/user'
export default {
  name: 'RegisterIndex',
  components: { UserForm },
  methods: {
    async isRegister (value) {
      const res = await registerAPI(value)
      if (res.data.code === 0) {
        // this.success(res.data.message);
        this.$message.success(res.data.message)
        this.$router.push('/login')
      }
    },
    success (value) {
      this.$notify({
        title: '成功',
        message: value,
        type: 'success',
        showClose: false
      })
    }
  }
}
</script>

<style scoped>

</style>
